package com.bupt.inklue.service;

import com.bupt.inklue.dto.PracticeDTO;
import com.bupt.inklue.pojo.Practice;
import com.bupt.inklue.repository.PracticeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class PracticeService {

    @Autowired
    private PracticeRepository practiceRepository;

    public List<PracticeDTO> getAll() {
        return ((List<Practice>) practiceRepository.findAll()).stream()
                .map(PracticeDTO::new)
                .collect(Collectors.toList());
    }
}
